define(function (require, exports, module) {
    var DropDown = function (callback) {
        this.init.apply(this,arguments);
    };
	DropDown.prototype = {
		constructor: DropDown,
        options: {},
        init: function (options) {
            var t = this;
    		t.dd = options;
    		t.placeholder = this.dd.children('span');
    		t.opts = this.dd.find('ul.dropdown > li');
    		t.val = '';
    		t.index = -1;
    		t.initEvents();
    		t.getValue();
    		t.getIndex();
        },
		initEvents: function() {
			var obj = this;

			obj.dd.on('click', function(event) {
				$(this).toggleClass('active');
				return false;
			});

			obj.opts.on('click', function() {
				var opt = $(this);
				obj.val = opt.text();
				obj.index = opt.index();
				obj.placeholder.text(obj.val);
			});
		},
		getValue: function() {
			return this.val;
		},
		getIndex: function() {
			return this.index;
		}
	}
	
	module.exports = DropDown;
});